"""弹出层 API Router"""
from typing import List
from typing_extensions import Annotated

from fastapi import APIRouter, Depends

from api.v1.service.newwin import NewwinServiceAPI
from api.v1.models.newwin import DeviceRequest, NewwinResponse
from api.v1.models.response import response_422, response_500

router = APIRouter()


@router.get("/newwins",
            summary="点亮图层弹出列表",
            responses={**response_422, **response_500})
async def read_newwins(
    service: Annotated[NewwinServiceAPI, Depends(NewwinServiceAPI.async_init)],
    query: Annotated[DeviceRequest, Depends()],
) -> List[NewwinResponse]:
# """
# 查看“层”弹出列表。
# -仅查看显示期内的弹出窗口。
# -使用LFU（Least Frequently Used）缓存进行查询。
# """
    return service.fetch_newwins(query.device.value)
